const Koa = require('koa');
const Router = require('koa-router')
const static = require('koa-static')
const path = require('path')
const IndexRouter = require('./routers/index')
const WeixinRouter = require('./routers/weixin')

const app = new Koa();

app.use(static(
  path.resolve(__dirname, './public')
))

var router = new Router();
router.use('/index', IndexRouter.routes())
router.use('/weixin',WeixinRouter.routes())

// app.use((ctx) => {
//   console.log(ctx.query)
//   ctx.body = ctx.query.echostr;
// })

app.use(router.routes())

app.listen(3001, () => {
  console.log('localhost:3001 start.')
})